//
//  MXOccoasionTopViewCollectionViewCell.m
//  MXの衣柜
//
//  Created by 马霄 on 15/8/6.
//  Copyright (c) 2015年 霄 马. All rights reserved.
//


#import "MXOccoasionTopViewCollectionViewCell.h"
#import "UIImageView+WebCache.h"
@implementation MXOccoasionTopViewCollectionViewCell
- (void)dealloc
{
    [_modelS release];
    [_mainImageView release];
    [_typeLabel release];
    [super dealloc];
}
-(instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame]) {
        self.mainImageView = [[[UIImageView alloc] init] autorelease];
        [self.contentView addSubview:self.mainImageView];
        
        self.typeLabel = [[[UILabel alloc] init] autorelease];
//        self.typeLabel.backgroundColor = [UIColor orangeColor];
        self.typeLabel.textAlignment = NSTextAlignmentCenter;
        self.typeLabel.font = [UIFont systemFontOfSize:12];
        [self.contentView addSubview:self.typeLabel];
        
    }
    return self;
}
-(void)layoutSubviews
{
    [super layoutSubviews];
    
    CGFloat wid = self.contentView.frame.size.width;
    CGFloat height = self.contentView.frame.size.height;
    
    self.mainImageView.frame = CGRectMake(0, 0, wid, wid);
    self.mainImageView.layer.cornerRadius = wid / 2;
    self.mainImageView.layer.masksToBounds = YES;
    
    self.typeLabel.frame = CGRectMake(0, wid, wid, height - wid);
    
}
-(void)GetInfo:(MXStyleModel *)model
{
    if (_modelS != model) {
        [_modelS release];
        _modelS = [model retain];
    }
    [self.mainImageView sd_setImageWithURL:[NSURL URLWithString:model.classify_icon]placeholderImage:[UIImage imageNamed:@"plaseholder"]];
    self.typeLabel.text = model.classify_name;
    
    
}

@end
